Left Termination of the query pattern p(b,f) w.r.t. the given Prolog program could successfully be proven:



PROLOG
  ↳ PrologToPiTRSProof

p2(X, X).
p2(f1(X), g1(Y)) :- p2(f1(X), f1(Z)), p2(Z, g1(W)).


With regard to the inferred argument filtering the predicates were used in the following modes:
p2: (b,f) (b,b)
Transforming PROLOG into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:


p_2_in_ga2(X, X) -> p_2_out_ga2(X, X)
p_2_in_ga2(f_11(X), g_11(Y)) -> if_p_2_in_1_ga3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_ga3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_ga4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
p_2_in_gg2(X, X) -> p_2_out_gg2(X, X)
p_2_in_gg2(f_11(X), g_11(Y)) -> if_p_2_in_1_gg3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_gg3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_gg4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
if_p_2_in_2_gg4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_gg2(f_11(X), g_11(Y))
if_p_2_in_2_ga4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_ga2(f_11(X), g_11(Y))

The argument filtering Pi contains the following mapping:
p_2_in_ga2(x1, x2)  =  p_2_in_ga1(x1)
f_11(x1)  =  f_11(x1)
g_11(x1)  =  g_1
p_2_out_ga2(x1, x2)  =  p_2_out_ga1(x2)
if_p_2_in_1_ga3(x1, x2, x3)  =  if_p_2_in_1_ga1(x3)
if_p_2_in_2_ga4(x1, x2, x3, x4)  =  if_p_2_in_2_ga1(x4)
p_2_in_gg2(x1, x2)  =  p_2_in_gg2(x1, x2)
p_2_out_gg2(x1, x2)  =  p_2_out_gg
if_p_2_in_1_gg3(x1, x2, x3)  =  if_p_2_in_1_gg1(x3)
if_p_2_in_2_gg4(x1, x2, x3, x4)  =  if_p_2_in_2_gg1(x4)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of PROLOG



↳ PROLOG
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

p_2_in_ga2(X, X) -> p_2_out_ga2(X, X)
p_2_in_ga2(f_11(X), g_11(Y)) -> if_p_2_in_1_ga3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_ga3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_ga4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
p_2_in_gg2(X, X) -> p_2_out_gg2(X, X)
p_2_in_gg2(f_11(X), g_11(Y)) -> if_p_2_in_1_gg3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_gg3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_gg4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
if_p_2_in_2_gg4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_gg2(f_11(X), g_11(Y))
if_p_2_in_2_ga4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_ga2(f_11(X), g_11(Y))

The argument filtering Pi contains the following mapping:
p_2_in_ga2(x1, x2)  =  p_2_in_ga1(x1)
f_11(x1)  =  f_11(x1)
g_11(x1)  =  g_1
p_2_out_ga2(x1, x2)  =  p_2_out_ga1(x2)
if_p_2_in_1_ga3(x1, x2, x3)  =  if_p_2_in_1_ga1(x3)
if_p_2_in_2_ga4(x1, x2, x3, x4)  =  if_p_2_in_2_ga1(x4)
p_2_in_gg2(x1, x2)  =  p_2_in_gg2(x1, x2)
p_2_out_gg2(x1, x2)  =  p_2_out_gg
if_p_2_in_1_gg3(x1, x2, x3)  =  if_p_2_in_1_gg1(x3)
if_p_2_in_2_gg4(x1, x2, x3, x4)  =  if_p_2_in_2_gg1(x4)


Pi DP problem:
The TRS P consists of the following rules:

P_2_IN_GA2(f_11(X), g_11(Y)) -> IF_P_2_IN_1_GA3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
P_2_IN_GA2(f_11(X), g_11(Y)) -> P_2_IN_GA2(f_11(X), f_11(Z))
IF_P_2_IN_1_GA3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> IF_P_2_IN_2_GA4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
IF_P_2_IN_1_GA3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> P_2_IN_GG2(Z, g_11(W))
P_2_IN_GG2(f_11(X), g_11(Y)) -> IF_P_2_IN_1_GG3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
P_2_IN_GG2(f_11(X), g_11(Y)) -> P_2_IN_GA2(f_11(X), f_11(Z))
IF_P_2_IN_1_GG3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> IF_P_2_IN_2_GG4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
IF_P_2_IN_1_GG3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> P_2_IN_GG2(Z, g_11(W))

The TRS R consists of the following rules:

p_2_in_ga2(X, X) -> p_2_out_ga2(X, X)
p_2_in_ga2(f_11(X), g_11(Y)) -> if_p_2_in_1_ga3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_ga3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_ga4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
p_2_in_gg2(X, X) -> p_2_out_gg2(X, X)
p_2_in_gg2(f_11(X), g_11(Y)) -> if_p_2_in_1_gg3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_gg3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_gg4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
if_p_2_in_2_gg4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_gg2(f_11(X), g_11(Y))
if_p_2_in_2_ga4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_ga2(f_11(X), g_11(Y))

The argument filtering Pi contains the following mapping:
p_2_in_ga2(x1, x2)  =  p_2_in_ga1(x1)
f_11(x1)  =  f_11(x1)
g_11(x1)  =  g_1
p_2_out_ga2(x1, x2)  =  p_2_out_ga1(x2)
if_p_2_in_1_ga3(x1, x2, x3)  =  if_p_2_in_1_ga1(x3)
if_p_2_in_2_ga4(x1, x2, x3, x4)  =  if_p_2_in_2_ga1(x4)
p_2_in_gg2(x1, x2)  =  p_2_in_gg2(x1, x2)
p_2_out_gg2(x1, x2)  =  p_2_out_gg
if_p_2_in_1_gg3(x1, x2, x3)  =  if_p_2_in_1_gg1(x3)
if_p_2_in_2_gg4(x1, x2, x3, x4)  =  if_p_2_in_2_gg1(x4)
IF_P_2_IN_2_GG4(x1, x2, x3, x4)  =  IF_P_2_IN_2_GG1(x4)
IF_P_2_IN_1_GG3(x1, x2, x3)  =  IF_P_2_IN_1_GG1(x3)
IF_P_2_IN_1_GA3(x1, x2, x3)  =  IF_P_2_IN_1_GA1(x3)
P_2_IN_GA2(x1, x2)  =  P_2_IN_GA1(x1)
P_2_IN_GG2(x1, x2)  =  P_2_IN_GG2(x1, x2)
IF_P_2_IN_2_GA4(x1, x2, x3, x4)  =  IF_P_2_IN_2_GA1(x4)

We have to consider all (P,R,Pi)-chains

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

P_2_IN_GA2(f_11(X), g_11(Y)) -> IF_P_2_IN_1_GA3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
P_2_IN_GA2(f_11(X), g_11(Y)) -> P_2_IN_GA2(f_11(X), f_11(Z))
IF_P_2_IN_1_GA3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> IF_P_2_IN_2_GA4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
IF_P_2_IN_1_GA3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> P_2_IN_GG2(Z, g_11(W))
P_2_IN_GG2(f_11(X), g_11(Y)) -> IF_P_2_IN_1_GG3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
P_2_IN_GG2(f_11(X), g_11(Y)) -> P_2_IN_GA2(f_11(X), f_11(Z))
IF_P_2_IN_1_GG3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> IF_P_2_IN_2_GG4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
IF_P_2_IN_1_GG3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> P_2_IN_GG2(Z, g_11(W))

The TRS R consists of the following rules:

p_2_in_ga2(X, X) -> p_2_out_ga2(X, X)
p_2_in_ga2(f_11(X), g_11(Y)) -> if_p_2_in_1_ga3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_ga3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_ga4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
p_2_in_gg2(X, X) -> p_2_out_gg2(X, X)
p_2_in_gg2(f_11(X), g_11(Y)) -> if_p_2_in_1_gg3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_gg3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_gg4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
if_p_2_in_2_gg4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_gg2(f_11(X), g_11(Y))
if_p_2_in_2_ga4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_ga2(f_11(X), g_11(Y))

The argument filtering Pi contains the following mapping:
p_2_in_ga2(x1, x2)  =  p_2_in_ga1(x1)
f_11(x1)  =  f_11(x1)
g_11(x1)  =  g_1
p_2_out_ga2(x1, x2)  =  p_2_out_ga1(x2)
if_p_2_in_1_ga3(x1, x2, x3)  =  if_p_2_in_1_ga1(x3)
if_p_2_in_2_ga4(x1, x2, x3, x4)  =  if_p_2_in_2_ga1(x4)
p_2_in_gg2(x1, x2)  =  p_2_in_gg2(x1, x2)
p_2_out_gg2(x1, x2)  =  p_2_out_gg
if_p_2_in_1_gg3(x1, x2, x3)  =  if_p_2_in_1_gg1(x3)
if_p_2_in_2_gg4(x1, x2, x3, x4)  =  if_p_2_in_2_gg1(x4)
IF_P_2_IN_2_GG4(x1, x2, x3, x4)  =  IF_P_2_IN_2_GG1(x4)
IF_P_2_IN_1_GG3(x1, x2, x3)  =  IF_P_2_IN_1_GG1(x3)
IF_P_2_IN_1_GA3(x1, x2, x3)  =  IF_P_2_IN_1_GA1(x3)
P_2_IN_GA2(x1, x2)  =  P_2_IN_GA1(x1)
P_2_IN_GG2(x1, x2)  =  P_2_IN_GG2(x1, x2)
IF_P_2_IN_2_GA4(x1, x2, x3, x4)  =  IF_P_2_IN_2_GA1(x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph contains 1 SCC with 6 less nodes.

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
PiDP
              ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

IF_P_2_IN_1_GG3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> P_2_IN_GG2(Z, g_11(W))
P_2_IN_GG2(f_11(X), g_11(Y)) -> IF_P_2_IN_1_GG3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))

The TRS R consists of the following rules:

p_2_in_ga2(X, X) -> p_2_out_ga2(X, X)
p_2_in_ga2(f_11(X), g_11(Y)) -> if_p_2_in_1_ga3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_ga3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_ga4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
p_2_in_gg2(X, X) -> p_2_out_gg2(X, X)
p_2_in_gg2(f_11(X), g_11(Y)) -> if_p_2_in_1_gg3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))
if_p_2_in_1_gg3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> if_p_2_in_2_gg4(X, Y, Z, p_2_in_gg2(Z, g_11(W)))
if_p_2_in_2_gg4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_gg2(f_11(X), g_11(Y))
if_p_2_in_2_ga4(X, Y, Z, p_2_out_gg2(Z, g_11(W))) -> p_2_out_ga2(f_11(X), g_11(Y))

The argument filtering Pi contains the following mapping:
p_2_in_ga2(x1, x2)  =  p_2_in_ga1(x1)
f_11(x1)  =  f_11(x1)
g_11(x1)  =  g_1
p_2_out_ga2(x1, x2)  =  p_2_out_ga1(x2)
if_p_2_in_1_ga3(x1, x2, x3)  =  if_p_2_in_1_ga1(x3)
if_p_2_in_2_ga4(x1, x2, x3, x4)  =  if_p_2_in_2_ga1(x4)
p_2_in_gg2(x1, x2)  =  p_2_in_gg2(x1, x2)
p_2_out_gg2(x1, x2)  =  p_2_out_gg
if_p_2_in_1_gg3(x1, x2, x3)  =  if_p_2_in_1_gg1(x3)
if_p_2_in_2_gg4(x1, x2, x3, x4)  =  if_p_2_in_2_gg1(x4)
IF_P_2_IN_1_GG3(x1, x2, x3)  =  IF_P_2_IN_1_GG1(x3)
P_2_IN_GG2(x1, x2)  =  P_2_IN_GG2(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting we can delete all non-usable rules from R.

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
PiDP
                  ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

IF_P_2_IN_1_GG3(X, Y, p_2_out_ga2(f_11(X), f_11(Z))) -> P_2_IN_GG2(Z, g_11(W))
P_2_IN_GG2(f_11(X), g_11(Y)) -> IF_P_2_IN_1_GG3(X, Y, p_2_in_ga2(f_11(X), f_11(Z)))

The TRS R consists of the following rules:

p_2_in_ga2(X, X) -> p_2_out_ga2(X, X)

The argument filtering Pi contains the following mapping:
p_2_in_ga2(x1, x2)  =  p_2_in_ga1(x1)
f_11(x1)  =  f_11(x1)
g_11(x1)  =  g_1
p_2_out_ga2(x1, x2)  =  p_2_out_ga1(x2)
IF_P_2_IN_1_GG3(x1, x2, x3)  =  IF_P_2_IN_1_GG1(x3)
P_2_IN_GG2(x1, x2)  =  P_2_IN_GG2(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem into ordinary QDP problem by application of Pi.

↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
                ↳ PiDP
                  ↳ PiDPToQDPProof
QDP
                      ↳ RuleRemovalProof

Q DP problem:
The TRS P consists of the following rules:

IF_P_2_IN_1_GG1(p_2_out_ga1(f_11(Z))) -> P_2_IN_GG2(Z, g_1)
P_2_IN_GG2(f_11(X), g_1) -> IF_P_2_IN_1_GG1(p_2_in_ga1(f_11(X)))

The TRS R consists of the following rules:

p_2_in_ga1(X) -> p_2_out_ga1(X)

The set Q consists of the following terms:

p_2_in_ga1(x0)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {P_2_IN_GG2, IF_P_2_IN_1_GG1}.
By using a polynomial ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

IF_P_2_IN_1_GG1(p_2_out_ga1(f_11(Z))) -> P_2_IN_GG2(Z, g_1)

Strictly oriented rules of the TRS R:

p_2_in_ga1(X) -> p_2_out_ga1(X)

Used ordering: POLO with Polynomial interpretation:

POL(p_2_out_ga1(x1)) = 1 + x1   
POL(P_2_IN_GG2(x1, x2)) = 2·x1 + x2   
POL(IF_P_2_IN_1_GG1(x1)) = x1   
POL(g_1) = 0   
POL(f_11(x1)) = 2 + 2·x1   
POL(p_2_in_ga1(x1)) = 2 + x1   



↳ PROLOG
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ PiDP
              ↳ UsableRulesProof
                ↳ PiDP
                  ↳ PiDPToQDPProof
                    ↳ QDP
                      ↳ RuleRemovalProof
QDP
                          ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

P_2_IN_GG2(f_11(X), g_1) -> IF_P_2_IN_1_GG1(p_2_in_ga1(f_11(X)))

R is empty.
The set Q consists of the following terms:

p_2_in_ga1(x0)

We have to consider all (P,Q,R)-chains.
The head symbols of this DP problem are {IF_P_2_IN_1_GG1, P_2_IN_GG2}.
The approximation of the Dependency Graph contains 0 SCCs with 1 less node.